#include <iostream>
using namespace std;

class Base {
public:
	Base (void) {
		cout << "基类中动态内存分配" << endl;
	}
	~Base (void) {
		cout << "基类中的动态资源的释放" << endl;
	}
};

class Derived:public Base {
public:
	Derived (void) {
		cout << "子类中动态内存分配" << endl;
	}
	~Derived (void) {
		cout << "子类中动态资源的释放" << endl;
	}
};

int main (void)
{
	//pb成为指向子类对象的基类
	Base *pb = new Derived;

	delete pb;

	return 0;
}
